<?php

/**
 * reaffectation form base class.
 *
 * @method reaffectation getObject() Returns the current form's model object
 *
 * @package    forumCDE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasereaffectationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                         => new sfWidgetFormInputHidden(),
      'demande_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('demande'), 'add_empty' => true)),
      'personne_id'                => new sfWidgetFormInputText(),
      'valideurOrigine_id'         => new sfWidgetFormInputText(),
      'valideurPersonneOrigine_id' => new sfWidgetFormInputText(),
      'valideurDestine_id'         => new sfWidgetFormInputText(),
      'valideurPersonneDestine_id' => new sfWidgetFormInputText(),
      'prestataireorigine'         => new sfWidgetFormInputCheckbox(),
      'nomPrestataireOrigine'      => new sfWidgetFormInputText(),
      'prestatairedestine'         => new sfWidgetFormInputCheckbox(),
      'nomPrestataireDestine'      => new sfWidgetFormInputText(),
      'justif_prestataire'         => new sfWidgetFormTextarea(),
      'commentaire'                => new sfWidgetFormTextarea(),
      'created_at'                 => new sfWidgetFormDateTime(),
      'updated_at'                 => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'demande_id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('demande'), 'required' => false)),
      'personne_id'                => new sfValidatorInteger(array('required' => false)),
      'valideurOrigine_id'         => new sfValidatorInteger(array('required' => false)),
      'valideurPersonneOrigine_id' => new sfValidatorInteger(array('required' => false)),
      'valideurDestine_id'         => new sfValidatorInteger(array('required' => false)),
      'valideurPersonneDestine_id' => new sfValidatorInteger(array('required' => false)),
      'prestataireorigine'         => new sfValidatorBoolean(array('required' => false)),
      'nomPrestataireOrigine'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'prestatairedestine'         => new sfValidatorBoolean(array('required' => false)),
      'nomPrestataireDestine'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'justif_prestataire'         => new sfValidatorString(array('required' => false)),
      'commentaire'                => new sfValidatorString(array('required' => false)),
      'created_at'                 => new sfValidatorDateTime(),
      'updated_at'                 => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('reaffectation[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'reaffectation';
  }

}
